#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
int com(int x, int y)
{
    int tmp = x;
    while (x % y)
    {
        tmp = x % y;
        x = y;
        y = tmp;
    }
    return tmp;
}
int main()
{
    int n = 0;
    long long x = 0;
    cin >> n >> x;
    cerr << n << " " << x << endl;
    int tmp = 0;
    for (int i = 0;i < n;i++)
    {
        cin >> tmp;
        if (tmp <= x)
        {
            //cerr<<"x="<<x<<",tmp="<<tmp<<endl;
            x += tmp;
        }
        else
        {
            //cerr<<"x="<<x<<",tmp="<<tmp<<" "<<com(x,tmp)<<endl;
            x += com(x, tmp);
        }
    }
    cout << x << endl;
    return 0;
}
